package handler

import (
	"net/http"

	"github.com/gin-gonic/gin"
	encryptionserver "notabug.org/BigWaffleMonster/tg-bot"
)

func (h *Handler) encryptData(c *gin.Context) {
	var input encryptionserver.UserData

	if err := c.BindJSON(&input); err != nil {
		c.JSON(http.StatusBadRequest, err) //Todo: create normal error handler
		return
	}

	err := h.service.EncryptData(input)

	if err != nil {
		c.JSON(http.StatusBadRequest, err) //Todo: create normal error handler
		return
	}
}

func (h *Handler) decryptData(c *gin.Context) {
	var input encryptionserver.UserData

	if err := c.BindJSON(&input); err != nil {
		c.JSON(http.StatusBadRequest, err) //Todo: create normal error handler
		return
	}

	err := h.service.EncryptData(input)

	if err != nil {
		c.JSON(http.StatusBadRequest, err) //Todo: create normal error handler
		return
	}
}
